Ext.define('TS.view.dilema.MovieGrid' , {
	extend: 'TS.lib.Grid',
	alias : 'widget.dilemapointmoviegrid',
	tbar:Factory.toolbar.search(),
	tbar:[
		Factory.btn.ico('search',Factory.toolbar._.go,{
			fix:'dilemapointmoviegrid',
			flds:{
				hidden:['argument']
			}
		}),
		
		{xtype:'hidden',name:'argument',names:['dilema_point_movie.dilema_point_id'],getVal:function(){
			return Util.fldVal('dilema_point->id');
		}},
		
		Factory.btn.ico('add',
			function(){
				var fix = 'dilemapointmovie';
				Factory.winForm(fix,null,'simple');
				
				Util.fldVal(fix+'->#dilema_point_id','dilema_point->id');
			}
		)
	
	],
	
	frame:false,
	store: 'DilemaPointMovie',
	listeners:{
		'itemdblclick':function(){
			
		}
	},
	columns: [
	 	{xtype: 'rownumberer'},{
			header:'ID',
			hidden:true,
			dataIndex:'dilema_point_movie_id'
		},{
			header:'Komentaż',
			hidden:true,
			dataIndex:'dilema_point_movie_comment',
			renderer:Factory.rend.div
		},{
			header:'Podgląd',
			width:250,
			dataIndex:'movie_source',
			//width:300,
			//fixed:true,
			align:'center',
			renderer:function(v,x,s){
				var d = s.data;
				
				d.movie_markup = 
					Ext.String.format(HTML.movie[d.movie_website_id == CONST.website.google ? '_google':'_youtube'](200),v);
				
				d.movie_author_name = Factory.rend.loose_dict(s.data.author_id,Dict.author);
				d.movie_language_name = Factory.rend.loose_dict(s.data.language_id,Dict.language);
				
				return new Ext.XTemplate(HTML.movie.panel).apply(d);
			}
		},{
			header:'Opis filmu',
			dataIndex:'movie_title',
			hidden:true,
			renderer:function(v,x,s){
				var d = s.data;
				d.movie_author_name = Factory.rend.loose_dict(s.data.author_id,Dict.author);
				d.movie_language_name = Factory.rend.loose_dict(s.data.language_id,Dict.language);
				return new Ext.XTemplate(HTML.movie.description).apply(d);
			}
		
		}
	]
});